﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ManagementConsole;
using System.Windows.Forms;

namespace GroupMappedDiskSnapInExtension
{
    class GroupPropertyPage : PropertyPage
    {
        private SharedData SharedData;
        private MappedDiskControl control;

        public GroupPropertyPage(SharedData SharedData)
        {            
            this.SharedData = SharedData;

            this.Title = "Mapped disks";

            control = new MappedDiskControl(this);

            this.Control = control;
        }

        protected override void OnInitialize()
        {
            control.RefreshData(this.SharedData.GetItem("DsObjectNames"));
        }

        protected override bool OnApply()
        {
            if(this.Dirty)
            {
               return control.OnApply(); 
            }
            else
            {
                return true;
            }
        }
    }
}
